FROM hub-nj.iwhalecloud.com/public/alpine3.17.0-zcm-offload:jre17.0.5

LABEL maintainer="ZTEsoft ZCM Team"

USER zpaas

RUN  mkdir -p /app/lib/aliyun_lib \
   && mkdir -p /app/lib/run \
   && mkdir -p /app/probe \
   && mkdir -p /app/prometheus \
   && mkdir -p /app/prometheus_install \
   && mkdir -p /app/apk \
   && mkdir /app/kapacitor \
   && mkdir /app/template \
   && mkdir -p /app/logs \
   && mkdir -p /app/mibs \
   && mkdir -p /app/jvm\
   && mkdir -p /app/etc

COPY --chown=zpaas:zpaas ./zcm-monitor*.jar /app/lib/
COPY --chown=zpaas:zpaas ./monitorConfig.properties /app/conf/
COPY --chown=zpaas:zpaas ./logback.xml /app/conf/
COPY --chown=zpaas:zpaas ./docker-app.def /app/
COPY --chown=zpaas:zpaas ./health_check.sh /app/

COPY --chown=zpaas:zpaas ./aliyun_lib /app/lib/aliyun_lib
COPY --chown=zpaas:zpaas ./zpaas_lib /app/lib/zpaas_lib
COPY --chown=zpaas:zpaas ./ctg_lib /app/lib/ctg_lib
COPY --chown=zpaas:zpaas ./common_lib /app/lib/common_lib
COPY --chown=zpaas:zpaas ./lib/*.jar /app/lib/run/
COPY --chown=zpaas:zpaas ./mibs /app/mibs/
COPY --chown=zpaas:zpaas ./key.pem /app/
COPY --chown=zpaas:zpaas ./probe /app/probe/
COPY --chown=zpaas:zpaas ./prometheus /app/prometheus/
COPY --chown=zpaas:zpaas ./prometheus_install /app/prometheus_install/
COPY --chown=zpaas:zpaas ./apk /app/apk/
COPY --chown=zpaas:zpaas ./kapacitor /app/kapacitor/
COPY --chown=zpaas:zpaas ./zcmMonitorTemplate.xlsx /app/template/
COPY --chown=zpaas:zpaas ./agentInatallTemplate.xlsx /app/template/
COPY --chown=zpaas:zpaas ./jvm/inms-agent.tar /app/jvm/
COPY --chown=zpaas:zpaas ./snmp_exporter.sh /app/

RUN chmod +x /app/docker-app.def \
   && chmod +x /app/health_check.sh \
   && chmod +x /app/prometheus_install/snmp_exporter/snmp.yml \
   && chmod +x /app/prometheus_install/snmp_exporter/snmp_exporter-0.20.0.linux-amd64 \
   && chmod +x /app/snmp_exporter.sh \
   && chmod +x /app/mibs \
   && chmod +x /app/prometheus_install
WORKDIR /app/

VOLUME /app/logs
ENV PINPOINT_TRACE=on
ENV APP_NAME=zcm-monitor
ENV ZSMART_HOME=/app/
ENV PAAS_PLATFORM=zpaas
ENV z_app=zcm-monitor

LABEL ztesoft.maintainer="ZCM TEAM" \
      ztesoft.support.contact="QQ group: 300504779" \
      ztesoft.build-date="" \
      ztesoft.license="" \
      ztesoft.image.type="application" \
      vendor="ztesoft" \
      zcm.logs.monitoring=/app/log/zcm-monitor.log \
      zcm.logs.monitoring.tags="project=kp" \
      zcm.logs.app="/app/logs/alarm/*" \
      zcm.logs.app.tags="project=bomc"

ENTRYPOINT ["/usr/local/bin/tini", "-g", "--", "docker-entrypoint.sh"]
CMD ["start"]